//双指针 美丽的区间
#include <bits/stdc++.h>
using namespace std;

const int N = 1e6;
int a[N];
int main()
{
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	int n=0,s=0;
	cin >> n >> s;
	for(int i = 0; i <= n; i++)
		cin >> a[i];
	
	int sum = 0;
	int ans = n+1;
	for(int l = 1, r = 0; l <= n; l++)
	{
		while(r<l || sum < s && r < n)
		{
			r++;
			sum += a[r];
		}
		if(sum >= s) ans = min(ans,r - l + 1);
		sum -= a[l];
	}
	if(ans == n+1)
		printf("0");
	else
		cout << ans;
	return 0;
}
